//
//  BMSIPBlockStatusModel.m
//  WDBMS
//
//  Created by YeJary on 2025/5/12.
//

#import "BMSIPBlockStatusModel.h"

@implementation BMSIPInfo

+ (instancetype)modelWithDictionary:(NSDictionary *)dict {
    BMSIPInfo *model = [[BMSIPInfo alloc] init];
    model.ip_address = dict[@"ip_address"] ?: @"";
    model.global = dict[@"global"] ?: @"";
    model.nation = dict[@"nation"] ?: @"";
    model.nation_name_en = dict[@"nation_name_en"] ?: @"";
    model.nation_name_en_abbr = dict[@"nation_name_en_abbr"] ?: @"";
    model.province = dict[@"province"] ?: @"";
    model.city = dict[@"city"] ?: @"";
    model.district = dict[@"district"] ?: @"";
    model.isp = dict[@"isp"] ?: @"";
    model.adcode = dict[@"adcode"] ?: @"";
    model.gps = dict[@"gps"] ?: @"";
    return model;
}

@end

@implementation BMSIPBlockStatusModel

+ (instancetype)modelWithDictionary:(NSDictionary *)dict {
    BMSIPBlockStatusModel *model = [[BMSIPBlockStatusModel alloc] init];
    model.isEnable = [dict[@"is_enable"] integerValue] == 1;
    NSDictionary *infoDict = dict[@"info"];
    if ([infoDict isKindOfClass:[NSDictionary class]]) {
        model.info = [BMSIPInfo modelWithDictionary:infoDict];
    }
    return model;
}

@end
